﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<BolaoDNA.DomainModel.Competicao>" %>

<asp:Content ID="Title" ContentPlaceHolderID="TitleContent" runat="server">
	EditarJogos
</asp:Content>

<asp:Content ID="Main" ContentPlaceHolderID="MainContent" runat="server">


    <h2>Editar Jogos</h2>
    
    <div id="sidebar">
        
        <div class="block">
            <h3>Atualizar Rankings</h3>
            <div class="content">          
                <% using (Html.BeginForm("AtualizarRank", "Bolao", new { ID = 1 }))
                   { %>
                <p>
                    <button class="button" type="submit">
                        Atualizar</button></p>
                <p>
                    &nbsp;</p>
                    </div>
                    </div>
                <% } %>
                
                <div class="block">
                    <h3>Bolões</h3>
                    <table class="table">
                        <tbody>
                            <tr>
                                <th>
                                    Nome
                                </th>
                                <th>
                                    Participantes
                                </th>
                            </tr>
                            <% foreach (var item in Model.Boloes)
                               { %>
                            <tr>
                                <td>
                                    <%= Html.Encode(item.Nome)%>
                                </td>
                                <td>
                                    <%= Html.Encode(item.InscricoesBolao.Count)%>
                                </td> 
                            </tr>
                            <% } %>
                        </tbody>
                        <tfoot>
                        </tfoot>
                    </table>
                </div>
                
                </div>
                
    
    <div id="main">
    
    <div class="block" id="block-tables">
            <div class="content">
                <h2 class="title">Jogos sem Resultados</h2>
                <div class="inner">
                    <% using (Html.BeginForm("SalvarResultados", null, new { ID = Model.ID }))
                       { %>
                    <table class="table">
                        <tr>
                            <th>
                                Data
                            </th>
                            <th>
                                Hora
                            </th>
                            <th>
                                Equipe da Casa
                            </th>
                            <th>
                                Placar Casa
                            </th>
                            <th>
                                X
                            </th>
                            <th>
                                Placar Visitante
                            </th>
                            <th>
                                Equipe Visitante
                            </th>
                         </tr>
    
                            <% int x = 1;
                               foreach (var item in Model.Jogos)
                               {
                                   if (item.PlacarCasa == null || item.PlacarVisitante == null)
                                   {
                                       x *= -1;
                        %>
                        
                        
                        <tr class='<%= x < 0 ? "odd" : "even" %>'>
                            
                            <%=Html.Hidden("idJogo", item.ID)%>
                            <td>
                                <%= Html.Encode(item.DataHora.ToShortDateString())%>
                            </td>
                            <td>
                                <%= Html.Encode(item.DataHora.ToShortTimeString())%>
                            </td>
                            <td>
                                <%= Html.Encode(item.EquipeCasa.Nome)%>
                            </td>
                            <td>
                                <%= Html.TextBox("PlacarCasa")%>
                            </td>
                            <td>
                                <p>
                                    X</p>
                            </td>
                            <td>
                                <%= Html.TextBox("PlacarVisitante")%>
                            </td>
                            <td>
                                <%= Html.Encode(item.EquipeVisitante.Nome)%>
                            </td>
                            </tr>
                            
                            <%} %>
                        
                        <% 
                        } %>
                    </table>
                    <div class="actions-bar wat-cf">
                        <div class="actions">
                            <button type="submit" class="button">Salvar resultados</button>
                        </div>
                        <div class="pagination">
                            <span class="disabled prev_page">« Previous</span><span class="current">1</span><a
                                rel="next" href="#">2</a><a href="#">3</a><a href="#">4</a><a href="#">5</a><a href="#">6</a><a
                                    href="#">7</a><a href="#">8</a><a href="#">9</a><a href="#">10</a><a href="#">11</a><a
                                        rel="next" class="next_page" href="#">Next »</a>
                        </div>
                    </div>
                   

               </div>
           </div>
            <% } %>
                    <% if ((Boolean?)ViewData["ResultadoHoraInvalido"] == true) {%>
<div class="flash">
<div class="message error"><p>Jogos que ainda nao terminaram nao podem ter resultados.</p></div>
</div>
<%} %>
    </div>
           <div class="block" id="Div1">
            <div class="content">
                <h2 class="title">
                    Últimos Jogos</h2>
                <div class="inner">
                    <form action="#" class="form">
                    <table class="table">
                        <tr>
                            <th>
                                Data
                            </th>
                            <th>
                                Hora
                            </th>
                            <th>
                                Equipe da Casa
                            </th>
                            <th>
                                Placar Casa
                            </th>
                            <th>
                                X
                            </th>
                            <th>
                                Placar Visitante
                            </th>
                            <th>
                                Equipe Visitante
                            </th>
                        </tr>
                        <% int w = 1;
                           foreach (var item in Model.Jogos)
                           {
                               if (item.PlacarCasa != null && item.PlacarVisitante != null)
                               {
                                   w = w * (-1);
                        %>
                        <tr class='<%= w < 0 ? "odd" : "even" %>'>
                            <td>
                                <%= Html.Encode(item.DataHora.ToShortDateString())%>
                            </td>
                            <td>
                                <%= Html.Encode(item.DataHora.ToShortTimeString())%>
                            </td>
                            <td>
                                <%= Html.Encode(item.EquipeCasa.Nome)%>
                            </td>
                            <td>
                                <%= Html.Encode(item.PlacarCasa)%>
                            </td>
                            <td>
                                <p>
                                    X</p>
                            </td>
                            <td>
                                <%= Html.Encode(item.PlacarVisitante)%>
                            </td>
                            <td>
                                <%= Html.Encode(item.EquipeVisitante.Nome)%>
                            </td>
                        </tr>
                        <% }
                                   } %>
                    </table>
                    <div class="actions-bar wat-cf">
                        <div class="actions">
                        </div>
                        <div class="pagination">
                            <span class="disabled prev_page">« Previous</span><span class="current">1</span><a
                                rel="next" href="#">2</a><a href="#">3</a><a href="#">4</a><a href="#">5</a><a href="#">6</a><a
                                    href="#">7</a><a href="#">8</a><a href="#">9</a><a href="#">10</a><a href="#">11</a><a
                                        rel="next" class="next_page" href="#">Next »</a>
                        </div>
                    </div>
                </div>
                                            
                
                
            </div>
        </div>



<div id="footer">
                    <div class="block">
                    
                        <p>
                            Copyright &copy; 2010 Your Site.</p>
                    </div>
                           </div>
                           </div>
                           

</asp:Content>
